﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using MVVM_CAD.Common;
using MVVM_CAD.Model;

namespace MVVM_CAD.Strategy
{
    public class ArcToolStrategy : StrategyBase
    {
        public ArcToolStrategy(IFigure figure) : base(figure)
        {
        }

        public override IFigure PerformMouseLeftClicDownEvent(Canvas canvas, IPoint point, IEnumerable<IFigure> figures)
        {
            ClickCount++;
            switch (ClickCount)
            {
                case 1:
                    ValidateFigureIsNew<Arc>();
                    Figure.PointsCollection.Add(point);
                    return Figure;
                case 2:
                    Figure.PointsCollection.Add(point);
                    return Figure;
            }

            var arcRepresentation = MVVM_CAD.Algorithms.Arc.GetArcRepresentation(Figure.InitialPoint, 
                                                                                 point,
                                                                                 Figure.FinalPoint);
            foreach (var pointInArc in arcRepresentation)
                Figure.PointsCollection.Add(pointInArc);

            FigureDrawer.DrawFigure(canvas, Figure);
            CloseFigureDrawing();
            return Figure;
        }

        public override IFigure PerformMouseLeftClicUpEvent(Canvas canvas, IPoint point, IEnumerable<IFigure> figures)
        {
            throw new NotImplementedException();
        }

        public override IFigure PerformMouseRightClicDownEvent(Canvas canvas, IPoint point, IEnumerable<IFigure> figures)
        {
            throw new NotImplementedException();
        }

        public override IFigure PerformMouseMoveEvent(IPoint point, IEnumerable<IFigure> figures)
        {
            throw new NotImplementedException();
        }

        public override IFigure PerformMouseMoveEvent(DrawingCanvas Canvas, CustomPoint point)
        {
            throw new NotImplementedException();
        }
    }
}
